package com.epoint.mobileoa.personalized.epointcompany.bizlogic;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.dom4j.Element;

import android.os.Message;

import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.datanalysis.XMLHelp;
import com.epoint.mobileoa.http.HttpHelp;
import com.epoint.mobileoa.personalized.epointcompany.model.ChuchaibaoxiaomingxiModel;
import com.epoint.mobileoa.personalized.epointcompany.model.ChuchaijihualistModel;

/**
 * @author liyc
 * @time 2012-4-26 下午4:07:12
 * @annotation 获取出差报销明细
 */
public class GetChuchaibaoxiaomingxiTask extends Task {

	/**
	 * @param con
	 * @param param
	 */
	public GetChuchaibaoxiaomingxiTask(SuperView con,
			HashMap<String, Object> param) {
		super(con, param);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		String rzguid = getParam().get("rzguid").toString();
		String ccguid = getParam().get("ccguid").toString();
		String seamurl = generateURL("Epoint_GetBaoxiaomingxiInfo",rzguid,ccguid);
		String bs = HttpHelp.getHttpBack(seamurl);
		setMessageToRefreshUI(mess, getCon(), bs);
	}
	
	public static List<ChuchaibaoxiaomingxiModel> XmlAnalysis(String xml){
		List focs = XMLHelp.getRoot(xml).elements();
		List<ChuchaibaoxiaomingxiModel> plist = new ArrayList<ChuchaibaoxiaomingxiModel>();
		for (int i = 0; i < focs.size(); i++) {
			ChuchaibaoxiaomingxiModel mt = new ChuchaibaoxiaomingxiModel();
			Element foc = (Element) focs.get(i);
			if (foc.element("RowGuid") != null)
				mt.RowGuid = foc.elementText("RowGuid");
			if (foc.element("BXMoney") != null)
				mt.BXMoney = foc.elementText("BXMoney");
			if (foc.element("Remark") != null)
				mt.Remark = foc.elementText("Remark");
			if (foc.element("BXTypeName") != null)
				mt.BXTypeName = foc.elementText("BXTypeName");
			if (foc.element("fsdnames") != null)
				mt.fsdnames = foc.elementText("fsdnames");
			plist.add(mt);
		}
		return plist;
	}

}
